package com.idbk.chargestation.activity.pile;

import android.app.Activity;
import android.os.Bundle;

import com.idbk.chargestation.R;
import com.idbk.chargestation.api.ChargeStationURL;
import com.idbk.component.ui.image.MyImageViewer;

import java.util.ArrayList;
import java.util.List;

/**
 * 图片浏览器
 * @author lupc
 *
 */
public class ActivityImageScanner extends Activity {

	public final static String KEY_URLS = "key_urls";
	
	//图片浏览器
	private MyImageViewer mMyImageViewer;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_image_scanner);
		
		setupView();
		
		setupData();
	}

	private void setupView(){
		mMyImageViewer = (MyImageViewer) findViewById(R.id.activity_pile_banner);
	}

	private void setupData(){		
		List<String> images = getIntent().getStringArrayListExtra(KEY_URLS);
		if(images == null || images.size() == 0){
			finish();
		} else {
			List<String> urls = new ArrayList<String>(images.size());
			for (String string : images) {
				String url = ChargeStationURL.getAbsoluteApiUrlFromRoot(string);
				urls.add(url);
			}
			mMyImageViewer.initImages(urls);
		}				
	}

	
}
